/****************************************************
          File Name:6-9.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 19 Dec 2014 03:44:59 PM CST
*****************************************************/

#include<iostream>
#include<string>
#include<fstream>
#include<cstdlib>
using namespace std;

struct donate {
    string name;
    double num;
};

int main(int argc, char *argv[])
{

    if(argc < 2)
    {
        cout << "./" << argv[0] << "donater.txt" << endl;
        exit(EXIT_FAILURE);
    }
    char all;
    ifstream ifd;

    ifd.open(argv[1]);

    if(!ifd.is_open())
    {
        cout << "Can't open file" << endl;
        exit(EXIT_FAILURE);
    }

    (ifd.get(all)).get();

    donate *pro = new donate[all];

    for(int i = 0; i < all; i++)
    {
       getline(ifd, pro[i].name); 
       (ifd >> pro[i].num).get();
    }

    cout << "-------Grand Patrons---------" << endl;

    for(int i = 0; i < all; i++)
    {
        if(pro[i].num > 10000)
        {
            if(pro[i].name == "")
                cout << "Patrons:\tnone\n";
            else
                cout << "Patrons:\t" << pro[i].name << endl;
        }
    }

    delete [] pro;
    ifd.close();
    return 0;
}
